<!--********************************************************************
* Copyright© 2000 - 2018 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>

<head>
    <meta charset='utf-8' />
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
    <script type="text/javascript" include="jquery" src="../js/include-web.js"></script>
    <title data-i18n="resources.title_mapvCsvcarWGS84"></title>
    <style>
        body {
            margin: 0;
            padding: 0;
        }

        #map {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 100%;
        }
    </style>
</head>

<body>
    <div id='map'></div>
    <script type="text/javascript" include='mapbox-gl-enhance,mapv,proj4' src="../../dist/mapboxgl/include-mapboxgl.js"></script>

    <script type="text/javascript">
        var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
        var map = new mapboxgl.Map({
            container: 'map', 
            style: {
                "version": 8,
                "sources": {
                    "raster-tiles": {
                        "type": "raster",
                        "tiles": [host + '/iserver/services/map-world/rest/maps/World'],
                        "rasterSource":"iserver",
                        "tileSize": 256
                    }
                },

                "layers": [{
                    "id": "simple-tiles",
                    "type": "raster",
                    "source": "raster-tiles",
                    "minzoom": 0,
                    "maxzoom": 22
                }]
            },
            crs: mapboxgl.CRS.EPSG4326,
            center: [106.563777, 29.578285],
            zoom: 11
        });
        map.on('load', function () {
            $.get('../data/car.csv', function (csvstr) {
                var dataSet = mapv.csv.getDataSet(csvstr);
                for (var i = 0; i < dataSet._data.length; i++) {
                    var item = dataSet._data[i];
                    for (var j = 0; j < item.geometry.coordinates.length; j++) {
                        dataSet._data[i].geometry.coordinates[j] = item.geometry.coordinates[j];
                        dataSet._data[i].geometry.coordinates[j] = dataSet._data[i].geometry.coordinates[j];
                    }
                }
                var options = {
                    strokeStyle: 'rgba(50, 50, 255, 0.8)',
                    lineWidth: 0.05,
                    globalCompositeOperation: 'lighter',
                    draw: 'simple'
                };
                new mapboxgl.supermap.MapvLayer(map, dataSet, options);
            });
            setTimeout(function () {
                new mapboxgl.Popup({ closeOnClick: false })
                    .setLngLat(map.getCenter())
                    .setHTML(resources.text_iClient9)
                    .addTo(map);
            }, 1000)
        });

    </script>

</body>

</html>